<template>
  <div class="visual-list-container">
    <div class="item" v-for="(item, index) in visualItemList" :key="index">
      <div class="header">
        <div class="title">{{ item.title }}</div>
        <span class="date">{{ item.title.slice(0, 2) }}</span>
      </div>
      <div class="content">
        <strong class="num">{{ item.num }}</strong>
        <div class="tips">
          环比：<span class="ratio">{{ item.ratio }}</span>
          <span class="iconfont icon-xiala" v-if="item.ratio.charAt(0) === '-'">
          </span>
          <span v-else class="iconfont icon-xiangshang1"></span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'visual-item',
  props: {
    visualItemList: {
      required: true,
      type: Array,
      default: () => [],
    },
  },
}
</script>

<style lang="scss" scoped>
.visual-list-container {
  width: 100%;
  height: 140px;
  .item {
    float: left;
    width: 23%;
    height: 100%;
    min-width: 200px;
    margin-left: 2.6%;
    padding: 0 20px;
    box-sizing: border-box;
    background-color: #f7f7f7;
    border-radius: 4px;
    &:first-of-type {
      margin-left: 0;
    }
    .header {
      height: 50px;
      .title {
        line-height: 50px;
        float: left;
      }
      .date {
        float: right;
        margin-top: 13px;
        width: 50px;
        height: 24px;
        text-align: center;
        line-height: 24px;
        font-size: 12px;
        color: #1890ff;
        background-color: #e8f4ff;
      }
    }
    .content {
      margin-top: 15px;
      .num {
        font-size: 28px;
      }
      .tips {
        margin-top: 8px;
        font-size: 12px;
        .ratio {
          color: #1890ff;
        }
        .iconfont {
          margin-left: 6px;
          font-size: 12px;
          vertical-align: baseline;
        }
      }
    }
  }
}
</style>
